<html><head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Analysis" rel="Chapter" href="Analysis.html">
<link title="Ast" rel="Chapter" href="Ast.html">
<link title="Ast_info" rel="Chapter" href="Ast_info.html">
<link title="Environment" rel="Chapter" href="Environment.html">
<link title="Expression" rel="Chapter" href="Expression.html">
<link title="Filename_util" rel="Chapter" href="Filename_util.html">
<link title="Interpreter" rel="Chapter" href="Interpreter.html">
<link title="Jtemplate" rel="Chapter" href="Jtemplate.html">
<link title="Lexer" rel="Chapter" href="Lexer.html">
<link title="Library" rel="Chapter" href="Library.html">
<link title="Library_builtin" rel="Chapter" href="Library_builtin.html">
<link title="Library_io" rel="Chapter" href="Library_io.html">
<link title="Library_string" rel="Chapter" href="Library_string.html">
<link title="Parser" rel="Chapter" href="Parser.html">
<link title="Parser_util" rel="Chapter" href="Parser_util.html">
<link title="RuntimeError" rel="Chapter" href="RuntimeError.html"><title>RuntimeError.string_of_error</title>
</head>
<body>
<code class="code"><span class="keyword">let</span>&nbsp;string_of_error&nbsp;ex&nbsp;=<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">match</span>&nbsp;ex&nbsp;<span class="keyword">with</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">InternalError</span>&nbsp;msg&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"INT-00&nbsp;internal&nbsp;error,&nbsp;interpreter&nbsp;is&nbsp;in&nbsp;inconsistent&nbsp;state:&nbsp;"</span>^msg<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">LibraryError</span>&nbsp;msg&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"LIB-00&nbsp;library&nbsp;error:&nbsp;"</span>^msg<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">LexerException</span>&nbsp;(msg,&nbsp;line,&nbsp;col)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"PRS-00&nbsp;parsing&nbsp;error:&nbsp;"</span>&nbsp;^&nbsp;msg&nbsp;^&nbsp;<span class="string">"&nbsp;at&nbsp;line&nbsp;"</span>&nbsp;^<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(string_of_int&nbsp;line)&nbsp;^&nbsp;<span class="string">"&nbsp;column&nbsp;"</span>&nbsp;^&nbsp;(string_of_int&nbsp;col)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">ParseException</span>&nbsp;msg&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"PRS-01&nbsp;parsing&nbsp;error:&nbsp;"</span>&nbsp;^&nbsp;msg<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EIncompatibleTypes</span>(type1,&nbsp;type2)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-00&nbsp;incompatible&nbsp;types&nbsp;"</span>&nbsp;^&nbsp;type1&nbsp;^&nbsp;<span class="string">"&nbsp;and&nbsp;"</span>&nbsp;^&nbsp;type2<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EInvalidCast</span>(type1,&nbsp;type2)&nbsp;<span class="keywordsign">-&gt;</span><span class="string">"EXP-01&nbsp;cannot&nbsp;cast&nbsp;a&nbsp;"</span>&nbsp;^&nbsp;type1&nbsp;^&nbsp;<span class="string">"&nbsp;to&nbsp;a&nbsp;"</span>&nbsp;^&nbsp;type2<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EInvalidOperation</span>(operator,&nbsp;type1)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-02&nbsp;invalid&nbsp;operation&nbsp;"</span>&nbsp;^&nbsp;operator&nbsp;^&nbsp;<span class="string">"&nbsp;for&nbsp;"</span>&nbsp;^&nbsp;type1&nbsp;^&nbsp;<span class="string">"s"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EInvalidComparaison</span>(operator,&nbsp;type1,&nbsp;type2)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-03&nbsp;invalid&nbsp;comparaison&nbsp;"</span>&nbsp;^&nbsp;operator&nbsp;^&nbsp;<span class="string">"&nbsp;for&nbsp;"</span>&nbsp;^<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type1&nbsp;^&nbsp;<span class="string">"&nbsp;and&nbsp;"</span>&nbsp;^&nbsp;type2<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">ELeftSideIsNotAMap</span>&nbsp;(typename,&nbsp;value)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-04&nbsp;left&nbsp;side&nbsp;of&nbsp;member&nbsp;expression&nbsp;is&nbsp;not&nbsp;a&nbsp;map&nbsp;or&nbsp;array,&nbsp;but&nbsp;a&nbsp;"</span>&nbsp;^<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;^&nbsp;<span class="string">"&nbsp;with&nbsp;value&nbsp;"</span>&nbsp;^&nbsp;value<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">ELeftSideCannotBeAssigned</span>&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-05&nbsp;left&nbsp;side&nbsp;of&nbsp;assignment&nbsp;expression&nbsp;cannot&nbsp;be&nbsp;assigned"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EInvalidMember</span>&nbsp;(typename,&nbsp;value)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-06&nbsp;member&nbsp;expression&nbsp;did&nbsp;not&nbsp;evaluate&nbsp;to&nbsp;a&nbsp;string&nbsp;or&nbsp;integer,&nbsp;but&nbsp;to&nbsp;a&nbsp;"</span>&nbsp;^<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;^&nbsp;<span class="string">"&nbsp;with&nbsp;value&nbsp;"</span>&nbsp;^&nbsp;value<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EUndefinedMapMember</span>(name)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-07&nbsp;member&nbsp;expression&nbsp;"</span>&nbsp;^&nbsp;name&nbsp;^&nbsp;<span class="string">"&nbsp;is&nbsp;undefined"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EInvalidArrayIndex</span>(typename,&nbsp;value)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-08&nbsp;invalid&nbsp;array&nbsp;index&nbsp;of&nbsp;type&nbsp;"</span>&nbsp;^&nbsp;typename&nbsp;^&nbsp;<span class="string">"&nbsp;with&nbsp;value&nbsp;"</span>&nbsp;^&nbsp;value<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EArrayIndexOutOfBounds</span>(value)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-09&nbsp;array&nbsp;index&nbsp;out&nbsp;of&nbsp;bounds:&nbsp;"</span>&nbsp;^&nbsp;value<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">ETypeMismatchInAssignment</span>(name,&nbsp;shouldbe,&nbsp;is)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-10&nbsp;type&nbsp;mismatch&nbsp;in&nbsp;assignment&nbsp;of&nbsp;"</span>&nbsp;^&nbsp;name&nbsp;^<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="string">"&nbsp;declared&nbsp;as&nbsp;"</span>&nbsp;^&nbsp;shouldbe&nbsp;^&nbsp;<span class="string">",&nbsp;attempting&nbsp;to&nbsp;assign&nbsp;"</span>^is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EMismatchedFunctionArgs</span>(expected,&nbsp;actual)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-11&nbsp;wrong&nbsp;number&nbsp;of&nbsp;arguments&nbsp;in&nbsp;function&nbsp;call,&nbsp;expected&nbsp;"</span>&nbsp;^<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(string_of_int&nbsp;expected)&nbsp;^&nbsp;<span class="string">",&nbsp;got&nbsp;"</span>&nbsp;^&nbsp;(string_of_int&nbsp;actual)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">ENotAFunction</span>&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-12&nbsp;invalid&nbsp;function&nbsp;call&nbsp;on&nbsp;a&nbsp;non-function&nbsp;variable"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">ENotACollectionType</span>&nbsp;(msg,&nbsp;typename)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-13&nbsp;expected&nbsp;a&nbsp;collection&nbsp;type&nbsp;for&nbsp;"</span>&nbsp;^&nbsp;msg&nbsp;^&nbsp;<span class="string">",&nbsp;but&nbsp;got&nbsp;a&nbsp;"</span>&nbsp;^<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">Division_by_zero</span>&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"EXP-14&nbsp;Division&nbsp;by&nbsp;zero"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">EDefaultCaseShouldBeLast</span>&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"STM-00&nbsp;the&nbsp;default&nbsp;case&nbsp;in&nbsp;a&nbsp;switch&nbsp;statement&nbsp;should&nbsp;be&nbsp;the&nbsp;last&nbsp;case"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">CFReturn</span>&nbsp;_&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"STM-01&nbsp;unexpected&nbsp;return&nbsp;statement&nbsp;outside&nbsp;of&nbsp;a&nbsp;function&nbsp;definition"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">CFBreak</span>&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"STM-02&nbsp;unexpected&nbsp;break&nbsp;statement&nbsp;outside&nbsp;of&nbsp;a&nbsp;loop"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">CFContinue</span>&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"STM-03&nbsp;unexpected&nbsp;continue&nbsp;statement&nbsp;outside&nbsp;of&nbsp;a&nbsp;loop"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">CFUserException</span>&nbsp;(_,&nbsp;value)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"USR-00&nbsp;unhandled&nbsp;user&nbsp;exception&nbsp;"</span>&nbsp;^&nbsp;value<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="constructor">Parsing</span>.<span class="constructor">Parse_error</span>&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">""</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;e&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="string">"uncaught&nbsp;exception&nbsp;"</span>^(<span class="constructor">Printexc</span>.to_string&nbsp;e)</code></body></html>